package com.zlt.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.zlt.annotation.Column;
import com.zlt.annotation.Id;
import com.zlt.annotation.ManyToOne;
import com.zlt.annotation.Table;

@Table(name = "cart_details")
public class Cart_Details {

    @Id(name = "details_id")
    private int did;// 购物车详情主键id

    @ManyToOne(name = "dish_id")
    @JSONField
    private Dish dish;// 外键，商品id

    @Column
    @JSONField
    private int counts;// 菜品数量

    @Column
    @JSONField
    private double amount;// 此菜品总金额（菜品*数量）

    @Column
    @JSONField
    private int state;//菜品状态（0-正常 ，1-异常）

    public Cart_Details() {
    }

    public Cart_Details(int did, Dish dish, int counts, double amount, int state) {
        this.did = did;
        this.dish = dish;
        this.counts = counts;
        this.amount = amount;
        this.state = state;
    }

    public int getDid() {
        return did;
    }

    public void setDid(int did) {
        this.did = did;
    }

    public Dish getDish() {
        return dish;
    }

    public void setDish(Dish dish) {
        this.dish = dish;
    }

    public int getCounts() {
        return counts;
    }

    public void setCounts(int counts) {
        this.counts = counts;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    @Override
    public String toString() {
        return "Cart_Details{" +
                "did=" + did +
                ", dish=" + dish +
                ", counts=" + counts +
                ", amount=" + amount +
                ", state=" + state +
                '}';
    }
}
